#include "../../lv_examples.h"
#include "stdio.h"
#if LV_USE_LABEL && LV_BUILD_EXAMPLES


/**
 * Show line wrap, re-color, line align and text scrolling.
 */
void lv_example_label_1(void)
{
//    lv_obj_t * label1 = lv_label_create(lv_scr_act());
//    lv_label_set_long_mode(label1, LV_LABEL_LONG_WRAP);     /*Break the long lines*/
//    lv_label_set_recolor(label1, true);                      /*Enable re-coloring by commands in the text*/
//    lv_label_set_text(label1, "#0000ff Re-color# #ff00ff words# #ff0000 of a# label, align the lines to the center "
//                      "and wrap long text automatically.");
//    lv_obj_set_width(label1, 150);  /*Set smaller width to make the lines wrap*/
//    lv_obj_set_style_text_align(label1, LV_TEXT_ALIGN_CENTER, 0);
//    lv_obj_align(label1, LV_ALIGN_CENTER, 0, -40);

    lv_obj_t * label2 = lv_label_create(lv_scr_act());
    lv_label_set_long_mode(label2, LV_LABEL_LONG_WRAP);     /*Circular scroll*/
    lv_obj_set_width(label2, 150);
    lv_label_set_text(label2, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
    lv_obj_align(label2, LV_ALIGN_CENTER, 0, 0);
    lv_obj_set_style_text_color(label2, lv_color_hex(0x000000), LV_PART_MAIN);
    lv_obj_set_style_text_align(label2, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_bg_color(label2, lv_color_hex(0xff0000), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(label2, 255, LV_PART_MAIN | LV_STATE_DEFAULT);


/* ����һ�� Label ���� */
lv_obj_t *label = lv_label_create(lv_scr_act());
lv_label_set_text(label, "Your text here"); /* �����ı� */
lv_obj_set_width(label, 200); /* ���� Label �Ŀ��� */
lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_CENTER, 0); /* �����ı����ж��� */
}


void lv_fs_test_1() {
    lv_fs_file_t f;
    lv_fs_res_t res;

    res = lv_fs_open(&f, "C:/Users/CrackerTan/OneDrive - TecPal Limited/Desktop/lvgl_fs_test.txt", LV_FS_MODE_RD);
    if( res != LV_FS_RES_OK) {
        printf("open error\n");
        return;
    }

    uint32_t read_num;
    uint8_t buf[50] = {0};
    res = lv_fs_read(&f, buf, 50, &read_num);
    if( res != LV_FS_RES_OK) {
        printf("read error\n");
        return;
    }

    printf("%s\n",buf);

    lv_fs_close(&f);
}

#endif
